<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cookie</title>
<link href="CSS/css.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="text font18 fontB">Cookie
	<form>
		cookie键名:
		<input type="text" value="fff" id="cookieName" />
		<br />
		cookie键值:
		<input type="text" value="123" id="cookieValue" />
		<br />
		cookie存活时间:
		<input type="text" value="11" id="cookieTime" />
		<br />
		cookie路径:
		<input type="text" value="" id="cookiePath" />
		<br />
		cookie域:
		<input type="text" value="" id="cookieDomain" />
		<br />
		<input type="button" value="提交" onclick="getCookie()" /><br />
		cookie键名:
		<input type="text" value="搜索的键名" id="searchName" />
		<input type="button" value="搜" onclick="cSearch()" /><br />
		cookie键名:
		<input type="text" value="删除的键名" id="deleteName" />
		<input type="button" value="删" onclick="cDelete()" /><br />
	</form>
	<div id="show1" class="show"></div>
</div>
</body>
</html>
<script src="JS/cookie.js" type="text/javascript"></script>
<script language="javascript">
<!--	
	function showTime(sTime){
		var time=new Date();
		if(sTime==""){
			time.setTime(time.getTime()+24*3600*1000);	
		}else{
			time.setTime(time.getTime()+sTime*3600*1000);
		}
		var temp;
		temp="最新添加的Cookie失效时间为:"+time.getFullYear()+"年"+(time.getMonth()+1)+"月"+time.getDate()+"日"+time.getHours()+"时"+time.getMinutes()+"分"+time.getSeconds()+"秒";
		return temp;
	}
	
	function showPrint(str){
		document.getElementById("show1").innerHTML+=str+"<br>";
	}
	
	function getCookie(){
		var name= document.getElementById("cookieName").value;
		var value= document.getElementById("cookieValue").value;
		var time=document.getElementById("cookieTime").value;
		var path=document.getElementById("cookiePath").value;
		var domain=document.getElementById("cookieDomain").value;
		cookieSet(name,value,time,path,domain);
		showPrint(document.cookie);
		showPrint(showTime(time));
	}
	function cSearch(){
		showPrint(searchCookie(document.getElementById("searchName").value))	
	}
	function cDelete(){
		
		deleteCookie(document.getElementById("deleteName").value);
		showPrint(document.cookie);	
	}

-->
</script>